package io.lhj.chapter13;

public class ThreadCloseale extends Thread {

    //volatile关键字保证了started线程的可见性
    private volatile boolean started = true;
    @Override
    public void run()
    {
        while (started)
        {
//do work
        }
    }
    public void shutdown()
    {
        this.started = false;
    }
}
